<?php
include_once "DBCORE.cls.php";
class db_review
	{
		private $tablename="tblreviews";
		private $db;
		public function __construct()
		{
			$this->db= new DBCORE();
			$this->db->db_connect('localhost','root','','restaurant');
			$this->db->db_query("SET NAMES 'UTF8'");
		}
		
		public function selectAll($resId)
		{
			if(Empty($resId))
				return false;
			$myStrSQL = "SELECT * FROM {$this->tablename} WHERE RestaurantID='{$resId}'";
			$result=$this->db->db_query($myStrSQL);
			$resArray = array();
			while ($row = $this->db->db_fetch_assoc($result)) {
				$resArray[] = $row;
			}
			return $resArray;
		}
		public function insert($data)
		{
			$ResID = $data['RestaurantID'];
			$Email = $data['Email'];
			$Comment = $data['Comment'];
			$myStrSQL = "INSERT INTO {$this->tablename}(RestaurantID,Email,Comment,Time) VALUES ('$ResID','$Email','$Comment',NOW())";
			return ($this->db->db_query($myStrSQL));
		}
}
?>